from zope.app.component.hooks import getSite
from Products.CMFCore.utils import getToolByName
from apkn.resource.interfaces import IResource
import transaction

def setupVarious(context):
    return
def reindexResources(context):
    """ Reindex all resource objects.
    """   
    if context.readDataFile('apkn.resource_various.txt') is None:
        return

    # Add additional setup code here
    portal = getSite()
    catalog = getToolByName(portal, 'portal_catalog')
    [resource.getObject().reindexObject() for resource in catalog(object_provides=IResource.__identifier__)]
    portal.plone_log("Resources reindexed")  
    return
